home *** CD-ROM | disk | FTP | other *** search
- Path: sargas.omicron.se!usenet
- From: elias@cepheus.omicron.se (Elias Martenson)
- Newsgroups: comp.lang.c
- Subject: Re: returning ptr to struct with ptrs in it?
- Date: 27 Feb 1996 15:55:01 GMT
- Organization: Omicron
- Message-ID: <ELIAS.96Feb27165501@cepheus.omicron.se>
- References: <4gk852INNbp4@faatcrl.faa.gov> <4glcrtINNf4b@faatcrl.faa.gov>
- NNTP-Posting-Host: graffias.omicron.se
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Content-Transfer-Encoding: 7bit
- In-reply-to: lbona@saratoga's message of 23 Feb 1996 21:50:53 GMT
-
- In article <4glcrtINNf4b@faatcrl.faa.gov> lbona@saratoga (lbona) writes:
-
- > My real question is: why is it that if the struct ends with a pointer
- > or pointers, that area of memory is corrupted (made non-zero in this case)
- > yet if the struct ends in a non-pointer field the area of memory in
- > question is not changed? All the data is the same, including pointers in
- > the middle of the struct.
-
- You shouldn't be thinking about these things, beacuse
- its UU (Utterly Unsupported) anyway. Actually it's Undefined Behaviour.
-
- If you still want to know, I guess it's beacuse of pointer alignment,
- i.e. the struct is padded with some zeroes in the end, and those are
- the ones that get corrupted instead of the actual data following it.
-
- --
- Elias Martenson ! When I come up with a good joke,
- elias@omicron.se ! it will be here.
-